package com.dkm.orproject.dkmoa.service.serviceimpl.flow;

import com.dkm.orproject.dkmoa.dao.OaEntryTrainMapper;
import com.dkm.orproject.dkmoa.domain.OaEntryTrain;
import com.dkm.orproject.dkmoa.service.flow.OaEntryTrainService;
import com.dkm.orproject.utils.utils.IdToobtainUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @PROJECT_NAME: orproject
 * @DESCRIPTION:
 * @USER: 周佳佳
 * @DATE: 2020/8/10 16:28
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class OaEntryTrainServiceimpl implements OaEntryTrainService {
    @Autowired
    OaEntryTrainMapper oaEntryTrainMapper;
    @Resource
    IdToobtainUtils utils;
    /**
     * 增加培训经历的方法
     * @param record 对象
     * @return 返回行数
     */
    @Override
    public int insertSelective(OaEntryTrain record) {
        //id为随机生成
        record.setPkTrainId(utils.getNumberId());
        return oaEntryTrainMapper.insertSelective(record);
    }
    /**
     * 根据主键查询
     * @param pkTrainId 主键
     * @return 返回对象
     */
    @Override
    public OaEntryTrain selectByPrimaryKey(Long pkTrainId) {
        return oaEntryTrainMapper.selectByPrimaryKey(pkTrainId);
    }
    /**
     * 修改或逻辑删除
     * @param record 对象
     * @return 返回的行数
     */
    @Override
    public int updateByPrimaryKeySelective(OaEntryTrain record) {
        return oaEntryTrainMapper.updateByPrimaryKeySelective(record);
    }
    /**
     * 根据入职id查询
     * @param entryId 入职id
     * @return 返回数据
     */
    @Override
    public List<OaEntryTrain> selectAll(Long entryId) {
        return oaEntryTrainMapper.selectAll(entryId);
    }
    /**
     * 根据入职id查询(人员信息变更流程)
     * @param entryId 入职id
     * @return 返回数据
     */
    @Override
    public List<OaEntryTrain> selectAlls(Long entryId) {
        return oaEntryTrainMapper.selectAlls(entryId);
    }
}
